#!/bin/bash

cur_dir=$(dirname "$(readlink -f "$0")")
echo "$cur_dir"

pushd "$cur_dir" || exit
for module in modules/*/; do
    # 检查是否是目录
    if [ -d "$module" ]; then
        echo "Found directory: $module"
        echo "启动目录 $module 的 Docker Compose 服务..."
        docker compose -f "$module"/docker-compose.yml down
    else
        echo "目录 $module 不存在，跳过停止服务。"
    fi
done

docker network rm monitor_network
popd || exit